<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="../static/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="../static/css/sb-admin-2.css">
<link href="../static/prettify/github-v2.min.css" rel="stylesheet">
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
      <script src="../static/js/html5shiv.min.js"></script>
      <script src="../static/js/respond.min.js"></script>
    <![endif]-->
<style>
body {
	word-wrap: break-word;
}
</style>
</head>
<body onload="prettyPrint();">
	<div id="nav"></div>

	<div id="page-wrapper" style="padding: 10px">
		<div class="container-fluid">
			<div class="row">
				<div class="col-md-12">
					<div class="alert alert-warning">模板拦截器基于路径拦截器，所以无法对fragment以及非注册的PathTemplate进行拦截</div>
					实现一个模板拦截器只需实现
					<code>me.qyh.blog.web.template.TemplateInterceptor</code>
					即可，例如，如果需要所有自定义页面返回七夕快乐，可以这么做：
					<pre class="prettyprint lang-java">@Component
public class QxTemplateInterceptor extends HandlerInterceptorAdapter implements TemplateInterceptor {

	@Override
	public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
			throws Exception {
		response.setCharacterEncoding(Constants.CHARSET.name());
		response.setContentType("text/html");
		response.getWriter().write("七夕快乐");
		response.getWriter().flush();
		return false;
	}

	@Override
	public boolean match(String templateName, HttpServletRequest request) {
		return Page.isPageTemplate(templateName);
	}

}
					</pre>
					<div class="alert alert-warning">
						1.所有的拦截器必须在spring中注册，系统会进行自动扫描<br>
						2.需要额外注意登录页面，默认登录页面模板为SystemTemplate，路径为login，登录页面可以被覆盖，覆盖之后模板类型为Page，路径为login
					</div>
				</div>
			</div>
		</div>
	</div>
</body>

<script type="text/javascript" src="../static/jquery/jquery.min.js"></script>
<script type="text/javascript"
	src="../static/bootstrap/js/bootstrap.min.js"></script>
<script type="text/javascript" src="../static/prettify/prettify.js"></script>
<script>
	$(function() {
		$("#nav").load("nav.html");
	});
</script>
</html>